/*
 * Selling Partner API for Listings Restrictions
 * The Selling Partner API for Listings Restrictions provides programmatic access to restrictions on Amazon catalog listings.  For more information, see the [Listings Restrictions API Use Case Guide](https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/use-case-guides/listings-restrictions-api-use-case-guide/listings-restrictions-api-use-case-guide_2021-08-01.md).
 *
 * OpenAPI spec version: 2021-08-01
 * 
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 */


package com.amazon.spapi.listingsRestrictions_2021_08_01.model;

import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.amazon.spapi.listingsRestrictions_2021_08_01.model.Reason;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * A listing restriction, optionally qualified by a condition, with a list of reasons for the restriction.
 */
@ApiModel(description = "A listing restriction, optionally qualified by a condition, with a list of reasons for the restriction.")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2022-01-20T20:40:02.238+08:00")
public class Restriction {
  @SerializedName("marketplaceId")
  private String marketplaceId = null;

  /**
   * The condition that applies to the restriction.
   */
  @JsonAdapter(ConditionTypeEnum.Adapter.class)
  public enum ConditionTypeEnum {
    NEW_NEW("new_new"),
    
    NEW_OPEN_BOX("new_open_box"),
    
    NEW_OEM("new_oem"),
    
    REFURBISHED_REFURBISHED("refurbished_refurbished"),
    
    USED_LIKE_NEW("used_like_new"),
    
    USED_VERY_GOOD("used_very_good"),
    
    USED_GOOD("used_good"),
    
    USED_ACCEPTABLE("used_acceptable"),
    
    COLLECTIBLE_LIKE_NEW("collectible_like_new"),
    
    COLLECTIBLE_VERY_GOOD("collectible_very_good"),
    
    COLLECTIBLE_GOOD("collectible_good"),
    
    COLLECTIBLE_ACCEPTABLE("collectible_acceptable"),
    
    CLUB_CLUB("club_club");

    private String value;

    ConditionTypeEnum(String value) {
      this.value = value;
    }

    public String getValue() {
      return value;
    }

    @Override
    public String toString() {
      return String.valueOf(value);
    }

    public static ConditionTypeEnum fromValue(String text) {
      for (ConditionTypeEnum b : ConditionTypeEnum.values()) {
        if (String.valueOf(b.value).equals(text)) {
          return b;
        }
      }
      return null;
    }

    public static class Adapter extends TypeAdapter<ConditionTypeEnum> {
      @Override
      public void write(final JsonWriter jsonWriter, final ConditionTypeEnum enumeration) throws IOException {
        jsonWriter.value(enumeration.getValue());
      }

      @Override
      public ConditionTypeEnum read(final JsonReader jsonReader) throws IOException {
        String value = jsonReader.nextString();
        return ConditionTypeEnum.fromValue(String.valueOf(value));
      }
    }
  }

  @SerializedName("conditionType")
  private ConditionTypeEnum conditionType = null;

  @SerializedName("reasons")
  private List<Reason> reasons = null;

  public Restriction marketplaceId(String marketplaceId) {
    this.marketplaceId = marketplaceId;
    return this;
  }

   /**
   * A marketplace identifier. Identifies the Amazon marketplace where the restriction is enforced.
   * @return marketplaceId
  **/
  @ApiModelProperty(required = true, value = "A marketplace identifier. Identifies the Amazon marketplace where the restriction is enforced.")
  public String getMarketplaceId() {
    return marketplaceId;
  }

  public void setMarketplaceId(String marketplaceId) {
    this.marketplaceId = marketplaceId;
  }

  public Restriction conditionType(ConditionTypeEnum conditionType) {
    this.conditionType = conditionType;
    return this;
  }

   /**
   * The condition that applies to the restriction.
   * @return conditionType
  **/
  @ApiModelProperty(value = "The condition that applies to the restriction.")
  public ConditionTypeEnum getConditionType() {
    return conditionType;
  }

  public void setConditionType(ConditionTypeEnum conditionType) {
    this.conditionType = conditionType;
  }

  public Restriction reasons(List<Reason> reasons) {
    this.reasons = reasons;
    return this;
  }

  public Restriction addReasonsItem(Reason reasonsItem) {
    if (this.reasons == null) {
      this.reasons = new ArrayList<Reason>();
    }
    this.reasons.add(reasonsItem);
    return this;
  }

   /**
   * A list of reasons for the restriction.
   * @return reasons
  **/
  @ApiModelProperty(value = "A list of reasons for the restriction.")
  public List<Reason> getReasons() {
    return reasons;
  }

  public void setReasons(List<Reason> reasons) {
    this.reasons = reasons;
  }


  @Override
  public boolean equals(java.lang.Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    Restriction restriction = (Restriction) o;
    return Objects.equals(this.marketplaceId, restriction.marketplaceId) &&
        Objects.equals(this.conditionType, restriction.conditionType) &&
        Objects.equals(this.reasons, restriction.reasons);
  }

  @Override
  public int hashCode() {
    return Objects.hash(marketplaceId, conditionType, reasons);
  }


  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class Restriction {\n");
    
    sb.append("    marketplaceId: ").append(toIndentedString(marketplaceId)).append("\n");
    sb.append("    conditionType: ").append(toIndentedString(conditionType)).append("\n");
    sb.append("    reasons: ").append(toIndentedString(reasons)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private String toIndentedString(java.lang.Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }

}

